package day03;

/**
 * Created by Administrator on 2023/7/1 0001.
 */
public class Point implements Comparable<Point> {
    public Point(int x, int y) {
        this.x = x;
        this.y = y;
    }

    public Point(int x) {
        this(x,0);
    }

    public Point() {
        this(0);
    }

    public int getX() {
        return x;
    }

    public void setX(int x) {
        this.x = x;
    }

    public int getY() {
        return y;
    }

    public void setY(int y) {
        this.y = y;
    }

    @Override
    public String toString() {
        return String.format("(%d,%d)", x, y);
    }

    int x, y;

    @Override
    public int compareTo(Point that) {
        if (this.x != that.x) return this.x - that.x;
        else return this.y - that.y;
    }
}
